#pragma once
#ifndef _API_H_
#define _API_H_

#include <string>
#include <vector>
#include "BufferManager.h"
#include "CatalogManager.h"
#include "SQLStatement.h"

using namespace std;

class API {
    typedef vector<vector<string>> t_users;
public:
    API(string path);

    ~API(void);

    void Quit();

    void Help();

    void CreateDatabase(SQLCreateDatabase &statement);

    void CreateTable(SQLCreateTable &statement);

    void CreateIndex(SQLCreateIndex &statement);

    void ShowDatabases();

    void ShowTables();

    void DropDatabase(SQLDropDatabase &statement);

    void DropTable(SQLDropTable &statement);

    void DropIndex(SQLDropIndex &statement);

    void Use(SQLUse &statement);

    void Insert(SQLInsert &statement);

    void Select(SQLSelect &statement);

    void Delete(SQLDelete &statement);

    void Update(SQLUpdate &statement);

    void AddUser(string username, string password, string type);

    string ValidUser(string username, string password);

private:
    string path_;
    string current_db_;
    CatalogManager *catalog_m_;
    BufferManager *buffer_m_;
};

#endif
